"""

Note: these tests depend on Pinax/projects.

>>> import datetime
>>> from obols.models import *
>>> from projects.models import Project, Task
>>> from django.contrib.auth.models import User

>>> sally = User(username='sally')
>>> sally.save()
>>> agentsally = ObolAgent.objects.get_or_create(sally, sally.username)
>>> agentsally.save()
>>> agentsally.content_object
<User: sally>

>>> tom = User(username='tom')
>>> tom.save()
>>> agenttom = ObolAgent.objects.get_or_create(tom, tom.username)
>>> agenttom.save()
>>> agenttom.content_object
<User: tom>

>>> agenttom2 = ObolAgent.objects.get_or_create(tom, tom.username)
>>> agenttom2.save()
>>> agenttom.id == agenttom2.id
True

>>> event_date = datetime.datetime(2008, 7, 6)

>>> oe = ObolEvent(
...     from_whom=agenttom,
...     to_whom=agentsally,
...     what_for='Help with new site design',
...     web_resource='http://cloud27.com',
...     obols=3,
...     when=event_date)
>>> oe.save()
>>> oe
<ObolEvent: from: tom to: sally 3 obols for: Help with new site design on: 2008-07-06>

>>> proj = Project(
...     slug='obol_test',
...     name='Obol Test',
...     creator=sally,
...     description='Testing obols')
>>> proj.save()
>>> proj.members.add(sally, tom)

>>> task = Task(
...     project=proj,
...     summary='Obol test task',
...     creator=sally,
...     created=event_date,
...     assignee=tom)
>>> task.save()

>>> otg = ObolsToGive.objects.get_or_create(agentsally, proj)
>>> otg.obols=11
>>> otg.save()
>>> otg
<ObolsToGive: sally Obol Test 11>

>>> oe2 = ObolEvent(
...     group=proj,
...     from_whom=agentsally,
...     to_whom=agenttom,
...     what_resource=task,
...     obols=5,
...     when=event_date)
>>> oe2.save()
>>> oe2
<ObolEvent: from: sally to: tom 5 obols for: Obol test task on: 2008-07-06>

>>> agenttom.total_obols()
5

>>> agenttom.obols_from_group(proj)
5

>>> otg = ObolsToGive.objects.get_or_create(agentsally, proj)
>>> otg
<ObolsToGive: sally Obol Test 6>


"""